package com.guigu.alibaba.controller;


import com.guigu.alibaba.service.StorageService;
import com.guigu.springcloud.common.CommonResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/storage")
public class StorageController {

    @Resource
    private StorageService storageService;

    @GetMapping(value = "/decrease", produces = "application/json; charset=utf-8")
    public CommonResult decrease(Long productId, Integer count) {
        storageService.decrease(productId, count);
        return CommonResult.voData(200, "扣减库存成功！", null);
    }
}
